<?php $ui = $this->load->library('Ui'); ?>
	<h2>Theme Manager</h2>
<?php
	$header = $ui->makeOption('<a href="#" rel="#overlay">Get Help With This Page</a>' . ' '.
					anchor('theme_manager/admin', 'Manage') . ' '.
					anchor('theme_manager/admin/add', 'Install a Theme'). ' ', 1 ).
					'<div class="clear"></div>';
	
	$this->load->helper('url');
	
	$content = '<table cellspacing="1" cellpadding="5" width="100%"><tr class="head"><th>Theme Name</th><th width="13%">Activated</th><th width="13%">Actions</th></tr>';
	
	if ($themes){
		foreach($themes as $item)
		{
			$edit = base_url()."static/_css/images/icons/pencil.png";
			$delete = base_url()."static/_css/images/icons/module_delete.png";
			$activate = base_url()."static/_css/images/icons/layout.png";
			$yes = base_url()."static/_css/images/icons/tick.png";
			$no = base_url()."static/_css/images/icons/cross.png";
			
			$id = $item['id'];
			$name = $item['name'];
			$active = $item['active'];
			if ($active == 1){
				$active_img = '<img src="'.$yes.'" />';
			} else {
				$active_img = '<img src="'.$no.'" />';
			}
			
				$content .= "<tr>
								<td>".$name."</td>
								<td>".$active_img."</td>
								<td>";
				if($active == "0"){
					$content .= anchor(
								'theme_manager/admin/activate/'.$id,
								"<img src='$activate' />",
								array('onclick'=>"return confirm('Are you sure you want to activate this theme?')")
						)
						. " " .
						anchor(
								'theme_manager/admin/delete/'.$id,
								"<img src='$delete' />",
								array('onclick'=>"return confirm('Are you sure you want to Uninstall this theme?')")
						);
				}
				$content .= "</td></tr>\n";
		}
	}
	$content .= '</table>';
	
	echo $ui->makeDialog('Manage Themes'.$header,$content, 'maximize center');
?>
<div class="overlay" id="overlay">
	<!-- here is the content for overlay, can be anything -->
	<h2 style="margin:10px 0">Help! <em>Managing Themes.</em></h2>
	<p>
			<strong>Install a Theme</strong><br />
			<span class="help">This allows you to add themes you have downloaded or purchased.</span><br /><br />
	</p>
</div>
